home *** CD-ROM | disk | FTP | other *** search
/ Professional Soft Collection 1.02 / Professional Soft Collection 1.02.iso / nu80 / samples.bt! / SAMPLES.BTM
Text File  |  1994-04-23  |  5KB  |  148 lines

  1. @echo off
  2. cls
  3. echo %@upper[%0]:
  4. text
  5.  
  6.      This file contains several sample batch files.  We invite you to
  7.      study them in conjunction with your NDOS documentation. You may
  8.      want to PRINT or LIST the contents and modify any part you wish. The
  9.      various segments are separated from each other by a line of hyphens
  10.      ("-") so you can easily extract the specific component you're most
  11.      interested in.
  12.  
  13.      Included are:
  14.  
  15.        STATUS.BTM    - Gives a quick description of your system.
  16.        NMENU.BTM     - A very simple menuing system.
  17.        ONCEADAY.BTM  - Runs a command during the first boot of the day.
  18.  
  19. endtext
  20. pause
  21.  
  22. : ---------------------------------------------------------------------
  23. rem STATUS.BTM
  24. rem
  25. rem      This sample batch file will use some internal NDOS variable
  26. rem      functions to try to describe your current configuration.
  27. rem
  28. cls
  29. echo.^echo.
  30. echo System status:
  31. echo.
  32. echo Date: %_dow %_date
  33. echo Time: %_time
  34. echo NDOS version: %_nver
  35. echo OS: %_dos
  36. echo DOS version: %_dosver
  37. echos `CPU: `
  38. iff %_cpu == 86 then
  39.   echo 8088/8086
  40. elseiff %_cpu == 186 then
  41.   echo 80188/80186
  42. elseiff %_cpu == 200 then
  43.   echo V20/V30
  44. elseiff %_cpu == 286 then
  45.   echo 80286
  46. elseiff %_cpu == 386 then
  47.   echo 80386
  48. elseiff %_cpu == 486 then
  49.   echo 80486
  50. endiff
  51. if %_ndp ne 0 echo %_ndp Numeric Coprocessor detected
  52. echo Video: %_video
  53. echo Monitor type: %_monitor
  54. quit
  55.  
  56.  
  57. : ---------------------------------------------------------------------
  58. : NMENU.BTM
  59. :      This sample batch file will create a simple "menu" to run
  60. :      your commonly used programs.
  61. :
  62. :      Note that, instead of REM statements, it uses the alternative
  63. :      practice of creating "do-nothing" labels by starting comment
  64. :      lines such as this one with a ":"
  65. :
  66. @echo off
  67. :      First, we define a couple of aliases which will be used several
  68. :      times in the remainder of this batch file, after first saving
  69. :      any existing alias by the same name with the SETLOCAL command.
  70. setlocal
  71. alias in `pushd %1 ^ %2& ^ popd`
  72. alias choice `elseiff "%userchoice" == "%1" then`
  73. :
  74. :       Start with a clear screen
  75. cls
  76. :dispmenu
  77. :       Position the cursor
  78. screen 8 0
  79. :       Display the menu choices
  80. text
  81.  
  82.  Enter your choice:
  83.  
  84.       0. EXIT
  85.       1. Word Processing
  86.       2. Spreadsheet
  87.       3. Communications
  88.  
  89. endtext
  90. :      Ask the user to enter a value for environment variable CHOICE
  91. inkey Which? %%userchoice
  92. :      Does the user want to exit the menu?
  93. iff "%userchoice" == "0" then ^ quit
  94. :      Check the valid options
  95. :      Each line corresponds to a menu choice
  96. :      The parameters are a directory to go to, then the program to run
  97.   choice 1 ^ in c:\letters   c:\ws\ws.exe
  98.   choice 2 ^ in d:\finance   c:\quattro\q.exe
  99.   choice 3 ^ in c:\awremote  c:\awremote\awremote.exe
  100. else
  101. :      The user entered an invalid option
  102.   scrput 23 0 bri whi on red Invalid choice, try again
  103. endiff
  104. :      Loop back to the beginning
  105. goto dispmenu
  106.  
  107.  
  108. : ---------------------------------------------------------------------
  109. : ONCEADAY.BTM
  110. @echo off
  111. :
  112. :       This batch file will start a specified command the first time it
  113. :       is called each day after 6:00 in the morning
  114. :       example:
  115. :               ONCEADAY NDD C:    /Q
  116. :
  117. :       Note that, instead of REM statements, it uses the alternative
  118. :       practice of creating "do-nothing" labels by starting comment
  119. :       lines such as this one with a ":"
  120. :
  121. :
  122. :       First, we reset environment variable LASTDATE after saving any
  123. :       current value it may already have with the SETLOCAL command
  124. setlocal
  125. set lastdate=0
  126. :       Is there already a file called ONCEADAY.DAT in the
  127. :       root directory of the boot drive?
  128. iff exist %_boot:\onceaday.dat then
  129. :       If so, set LASTDATE to the contents of the first line
  130.   set lastdate=%@line[%_boot:\onceaday.dat,0]
  131. endiff
  132. :       Is the date in the file greater than today's date?
  133. :       (the @DATE function turns a date into an integer number)
  134. iff %@date[%_date] gt %lastdate then
  135. :       If so, is it currently past 6:00? (an arbitrary time)
  136.   iff %@time[%_time] gt %@time[06:00] then
  137. :       Yes! Invoke whatever command was passed as an argument to this
  138. :       batch file, then return
  139.     call %&
  140. :       After executing the command, place today's date in integer
  141. :       format into file ONCEADAY.DAT
  142.     echo %@date[%_today] >! %_boot:\onceaday.dat
  143.   endiff
  144. endiff
  145. :
  146.  
  147. 
  148.